package com.kaixinff.net;
import java.io.UnsupportedEncodingException;
import java.net.URLEncoder;

public class NameValuePair {
	private String name;
	private String value;

	public NameValuePair(String name, String value) {
		this.name = name;
		this.value = value;
	}

	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	public String getValue() {
		return value;
	}

	public void setValue(String value) {
		this.value = value;
	}
	
	public String toString() {
		return name + "=" + value;
	}
	
	public String encode(String charset) throws UnsupportedEncodingException {
		return URLEncoder.encode(name, charset) + "=" + URLEncoder.encode(value, charset);
	}

}
